package com.zfzs.post.modules.lesson.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;

/**
* @author wq
* @date 2019-12-04
*/
@Entity
@Data
@Table(name="lesson")
public class Lesson implements Serializable {

    // id
    @Id
    @Column(name = "lesson_id")
    private Integer lessonId;

    // 课堂标题
    @Column(name = "title")
    private String title;

    // 描述
    @Column(name = "content")
    private String content;

    // 封面图片
    @Column(name = "cover_url")
    private String coverUrl;

    // 跳转地址
    @Column(name = "jump_url")
    private String jumpUrl;

    // 详情地址
    @Column(name = "info_url")
    private String infoUrl;

    // 创建时间
    @Column(name = "create_time")
    private Date createTime;

    // 渠道id
    @Column(name = "channel_id")
    private Long channelId;

    // 类型 1:头部 单图2：抵不列表
    @Column(name = "type")
    private Integer type;

    // 是否删除 0否1是
    @Column(name = "is_del")
    private Integer isDel;

    public void copy(Lesson source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}